using System.Configuration;

namespace Bbq.Gallery
{
    public class GalleryProviderConfigSection : ConfigurationSection
    {
        internal new object this[string key]
        {
            get { return base[key]; }
            set { base[key] = value; }
        }

        [ConfigurationProperty("providers")]
        public ProviderSettingsCollection Providers
        {
            get
            {
                return (ProviderSettingsCollection)base["providers"];
            }
        }

        [ConfigurationProperty("galleryRootPath", DefaultValue="~/Gallery")]
        [StringValidator(InvalidCharacters="\\:*?\"<>|")]
        public string GalleryRootPath
        {
            get
            {
                return (string)base["galleryRootPath"];
            }
            set
            {
                base["galleryRootPath"] = value;
            }
        }

        [ConfigurationProperty("templatePath", DefaultValue = "~")]
        public string TemplatePath
        {
            get { return (string)base["templatePath"]; }
            set { base["templatePath"] = value; }
        }

        [ConfigurationProperty("defaultTemplate", DefaultValue = "Default")]
        public string DefaultTemplate
        {
            get { return (string)base["defaultTemplate"]; }
            set { base["defaultTemplate"] = value; }
        }

        [ConfigurationProperty("defaultAlbumThumbnail", DefaultValue = "default_album.jpg")]
        public string DefaultAlbumThumbnail
        {
            get { return (string)base["defaultAlbumThumbnail"]; }
            set { base["defaultAlbumThumbnail"] = value; }
        }

        [ConfigurationProperty("pageSize", DefaultValue = "12")]
        public string PageSize
        {
            get { return (string)base["pageSize"]; }
            set { base["pageSize"] = value; }
        }

        [ConfigurationProperty("dateTimeFormat", DefaultValue = "dd/MM/yyyy")]
        public string DateTimeFormat
        {
            get { return (string)base["dateTimeFormat"]; }
            set { base["dateTimeFormat"] = value; }
        }

        [ConfigurationProperty("galleryItemThumbnailX", DefaultValue = "132")]
        public string GalleryItemThumbnailX
        {
            get { return (string)base["galleryItemThumbnailX"]; }
            set { base["galleryItemThumbnailX"] = value; }
        }

        [ConfigurationProperty("galleryItemThumbnailY", DefaultValue = "99")]
        public string GalleryItemThumbnailY
        {
            get { return (string)base["galleryItemThumbnailY"]; }
            set { base["galleryItemThumbnailY"] = value; }
        }

        [ConfigurationProperty("galleryAlbumThumbnailX", DefaultValue = "135")]
        public string GalleryAlbumThumbnailX
        {
            get { return (string)base["galleryAlbumThumbnailX"]; }
            set { base["galleryAlbumThumbnailX"] = value; }
        }

        [ConfigurationProperty("galleryAlbumThumbnailY", DefaultValue = "101")]
        public string GalleryAlbumThumbnailY
        {
            get { return (string)base["galleryAlbumThumbnailY"]; }
            set { base["galleryAlbumThumbnailY"] = value; }
        }

        [ConfigurationProperty("thumbnailCompression", DefaultValue = "70")]
        public string ThumbnailCompression
        {
            get { return (string)base["thumbnailCompression"]; }
            set { base["thumbnailCompression"] = value; }
        }

        [ConfigurationProperty("handlerName", DefaultValue = "BBQThumbnail.ashx")]
        public string HandlerName
        {
            get { return (string)base["handlerName"]; }
            set { base["handlerName"] = value; }
        }

        [ConfigurationProperty("pagerTotal", DefaultValue = "10")]
        public string PagerTotal
        {
            get { return (string)base["pagerTotal"]; }
            set { base["pagerTotal"] = value; }
        }

        /// <summary>
        /// Gets or sets the type of the storage.
        /// </summary>
        /// <value>The type of the storage.</value>
        [ConfigurationProperty("storageType", DefaultValue="Mixed")]
        public string StorageType
        {
            get { return (string)base["storageType"]; }
            set { base["storageType"] = value; }
        }

        [ConfigurationProperty("defaultProvider", DefaultValue = "PhysicalStorageGalleryProvider")]
        [StringValidator(MinLength = 1)]
        public string DefaultProvider
        {
            get
            {
                return (string)base["defaultProvider"];
            }
            set
            {
                base["defaultProvider"] = value;
            }
        }
    }
}
